﻿using WindowsGame.Common;
using WindowsGame.Common.Library.Interfaces;
using WindowsGame.Common.Managers;
using WindowsGame.Common.TheGame;
using NUnit.Framework;
using Rhino.Mocks;

namespace WindowsGame.UnitTests
{
	public class BaseUnitTests
	{
		protected IBoardManager BoardManager;
		protected IConfigManager ConfigManager;
		protected IContentManager ContentManager;
		protected IDeviceManager DeviceManager;
		protected IFileManager FileManager;
		protected IInputManager InputManager;
		protected INumberManager NumberManager;
		protected IResolutionManager ResolutionManager;
		protected IScreenManager ScreenManager;
		protected ISpriteManager SpriteManager;
		protected ITextManager TextManager;
		protected IThreadManager ThreadManager;
		protected ILogger Logger;

#pragma warning disable 618
		[TestFixtureSetUp]
#pragma warning restore 618
		public void TestFixtureSetUp()
		{
			BoardManager = MockRepository.GenerateStub<IBoardManager>();
			ConfigManager = MockRepository.GenerateStub<IConfigManager>();
			ContentManager = MockRepository.GenerateStub<IContentManager>();
			DeviceManager = MockRepository.GenerateStub<IDeviceManager>();
			FileManager = MockRepository.GenerateStub<IFileManager>();
			InputManager = MockRepository.GenerateStub<IInputManager>();
			NumberManager = MockRepository.GenerateStub<INumberManager>();
			ResolutionManager = MockRepository.GenerateStub<IResolutionManager>();
			ScreenManager = MockRepository.GenerateStub<IScreenManager>();
			SpriteManager = MockRepository.GenerateStub<ISpriteManager>();
			TextManager = MockRepository.GenerateStub<ITextManager>();
			ThreadManager = MockRepository.GenerateStub<IThreadManager>();
			Logger = MockRepository.GenerateStub<ILogger>();
		}

		protected void SetUp()
		{
			IGameManager manager = new GameManager
			(
				BoardManager,
				ConfigManager,
				ContentManager,
				DeviceManager,
				FileManager,
				InputManager,
				NumberManager,
				ResolutionManager,
				ScreenManager,
				SpriteManager,
				TextManager,
				ThreadManager,
				Logger
			);

			MyGame.Construct(manager);
		}


#pragma warning disable 618
		[TestFixtureTearDown]
#pragma warning restore 618
		public void TestFixtureTearDown()
		{
			BoardManager = null;
			ConfigManager = null;
			ContentManager = null;
			DeviceManager = null;
			FileManager = null;
			InputManager = null;
			NumberManager = null;
			ResolutionManager = null;
			ScreenManager = null;
			SpriteManager = null;
			TextManager = null;
			ThreadManager = null;
			Logger = null;
		}
	}

}